<template>
  <el-tabs v-model="activeName" :tab-position="tabPosition" class="ddBase" @tab-click="tabClick">
    <el-tab-pane :label="$t('文档')" name="dataRoom">
      <ddBaseForm v-if="activeName === 'dataRoom'" ref="ddBaseForm" />
    </el-tab-pane>
    <!--    <el-tab-pane :label="$t('通知')" name="notify">-->
    <!--      通知-->
    <!--    </el-tab-pane>-->
    <el-tab-pane :label="$t('团队')" name="team">
      <ddExternalUserList v-if="activeName === 'team'" ref="ddExternalUserList" />
    </el-tab-pane>
  </el-tabs>
</template>
<script>
import ddBaseForm from './data/ddBaseForm.vue'
import ddExternalUserList from './user/ddExternalUserList.vue'
export default {
    components: {
        ddBaseForm,
        ddExternalUserList
    },
    data() {
        return {
            initData: {},
            activeName: 'dataRoom',
            tabPosition: 'left'
        }
    },
    methods: {
        init(data) {
            this.initData = data
            this.$nextTick(() => {
                this.$refs.ddBaseForm.init(data)
            })
        },
        tabClick(tab) {
            this.activeName = tab.name
            if (tab.name === 'dataRoom') {
                this.$nextTick(() => {
                this.$refs.ddBaseForm.init(this.initData)
            })
            }
        }
    }
}
</script>
